#include "ShowFactoryForTest.h"

#include "MockShowGuiInterface.h"
#include "ShowFileFactory.h"
#include "ShowLoader.h"
#include "MockShowWriter.h"
#include "ShowFileFormatter.h"

ShowFactoryForTest::ShowFactoryForTest(int numOfLightChannels, QObject *parent) :
   IF_ShowFactoryInterface(parent),
   m_notificationLog(NULL),
   m_numOfLightChannels(numOfLightChannels)
{
}


IF_ShowGuiInterface *ShowFactoryForTest::buildShowGui()
{
   Q_ASSERT( m_notificationLog != NULL);
   return new MockShowGuiInterface( *m_notificationLog, m_userSelectedFilePath);
}

ShowLoader *ShowFactoryForTest::buildShowLoader(IF_ShowGuiInterface *selectDialog, MediaListModel *mediaModel,
                                                 LightPresetModel *lightModel, SequenceModel *sequenceModel,
                                                 IF_ScriptEngineInterface *scriptInterafce)
{
   ShowFileFactory *parserFactory = new ShowFileFactory( m_numOfLightChannels, this);
   ShowLoader *loader = new ShowLoader( *selectDialog, parserFactory, mediaModel, lightModel,
                                        sequenceModel, scriptInterafce, this);

   return loader;
}


IF_ShowWriterInterface *ShowFactoryForTest::buildShowWriter( ShowFileFormatter * /*formatter*/)
{
   return new MockShowWriter( this);
}


ShowFileFormatter *ShowFactoryForTest::buildShowFileFormatter( const IF_ScriptEngineInterface &script,
                                                               const QAbstractListModel & mediaModel,
                                                               const QAbstractListModel & lightsetModel,
                                                               const QAbstractListModel &sequenceModel)
{
   return new ShowFileFormatter( script, mediaModel, lightsetModel, sequenceModel);
}


void ShowFactoryForTest::deleteShowGui(IF_ShowGuiInterface *showGui)
{
   delete showGui;
}

void ShowFactoryForTest::deleteShowLoader(ShowLoader *showLoader)
{
   delete showLoader;
}

void ShowFactoryForTest::deleteShowWriter(IF_ShowWriterInterface *showWriter)
{
   delete showWriter;
}

void ShowFactoryForTest::deleteShowFileFormatter(ShowFileFormatter *formatter)
{
   delete formatter;
}
